﻿using Shop.RemoteModel.Activity;
using Shop.RemoteModel.Activity.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class ActivityEvent : IRpcApiService
    {
        private readonly IActivityService _Service;

        public ActivityEvent ( IActivityService service )
        {
            this._Service = service;
        }

        public long AddActivity ( AddActivity obj )
        {
            return this._Service.Add(obj.Datum);
        }
        public ActivityBase[] GetActivitys ( GetActivitys obj )
        {
            return this._Service.Gets(obj.Ids);
        }
        public bool ActivityOffShelf ( ActivityOffShelf obj )
        {
            return this._Service.OffShelf(obj.Id);
        }
        public bool SubmitActivityAuditResult ( SubmitActivityAuditResult obj )
        {
            return this._Service.SetAuditStatus(obj.Id, obj.Result);
        }
        public void DeleteActivity ( DeleteActivity obj )
        {
            this._Service.Delete(obj.Id);
        }

        public ActivityData GetActivity ( GetActivity obj )
        {
            return this._Service.Get(obj.Id);
        }

        public PagingResult<ActivityBase> QueryActivity ( QueryActivity obj )
        {
            return this._Service.Query(obj.Query, obj.ToBasicPage());
        }

        public bool SetActivity ( SetActivity obj )
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
    }
}
